<?php
/**
 * Created by PhpStorm.
 * User: wudiying
 * Date: 2020/2/17
 * Time: 上午2:07
 */

/**
 * swoole之tcp客户端


 */

// 创建tcp客户端
$client = new swoole_client(SWOOLE_SOCK_TCP);

//连接服务器 超时时间5
$client->connect('120.79.71.129', 8035, 5) or die('连接失败');

//发送数据
$client->send('hello') or die('发送失败');

//接收数据
$data = $client->recv();

//打印
var_dump($data);

//关闭客户端
$client->close();
